<html>
<head>
    <link href="demo.css" rel="stylesheet"/>
    <style type='text/css'>
        iframe {
            border: 0px
        }

        table, tr, td {
            border: 0px
        }
    </style>
</head>
<body>
<div class="topnav">
    <a class="menu" href="http://localhost:8080/">Demo Home</a>
    <a class="menu"
       href="https://github.com/jetty/jetty.project/tree/jetty-12.0.x/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-async-rest/jetty-ee10-demo-async-rest-webapp/">Source</a>
    <a class="menu" href="https://jetty.org/">Jetty Project Home</a>
    <a class="menu" href="https://jetty.org/docs/">Documentation</a>
    <a class="menu" href="https://webtide.com">Commercial Support</a>
</div>

<div class="content">
    <center>
        <span style="color:red; font-style:italic; font-weight:bold">Demo Web Application Only - Do NOT Deploy in Production</span>
    </center>


    <h1>Blocking vs Asynchronous REST</h1>
    <p>
        This demo calls the EBay WS API both synchronously and asynchronously, to obtain items matching each of the
        keywords passed on the query string. The time the request thread is held by the servlet is displayed in red for
        both.
    </p>

    <table width='100%'>

        <tr>
            <td>
                <iframe height='175px' id="f1" src="testSerial?items=kayak" width='100%'></iframe>
            </td>
            <td>
                <iframe height='175px' id="f3" src="testSerial?items=mouse,beer,gnome" width='100%'></iframe>
            </td>
        </tr>

        <tr>
            <td>
                <iframe height='175px' id="f2" src="testAsync?items=kayak" width='100%'/>
                </iframe>
            </td>
            <td>
                <iframe height='175px' id="f4" src="testAsync?items=mouse,beer,gnome" width='100%'/>
                </iframe>
            </td>
        </tr>

    </table>
    <p>
        By the use of Asynchronous Servlets and the Jetty Asynchronous client, the server is able to release the thread
        (green) while waiting for the response from Ebay. This thread goes back into the thread pool and can service
        many other requests during the wait. This greatly reduces the number of threads needed, which in turn greatly
        reduces the memory requirements of the server.
    </p>
    <p>
        Press your browser's reload button to see even better results after JIT and TCP/IP warmup!
    </p>
</div>

<div class="footer">
    <center><a href="https://eclipse.dev/jetty"><img src="small_powered_by.gif" style="border:0"/></a></center>
</div>

</body>
</html>
